package com.peng._05mvcboot02.mapper;

import com.peng._05mvcboot02.pojo.entity.User;
import com.peng._05mvcboot02.pojo.vo.UserListVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 用户Mapper
 * @Author peng
 * @Date 2024-04-22 11:21
 */
//@Mapper
public interface UserMapper {

    int insertUser(User user);

    List<User> selectUserByUsername(String username);

    @Select("select username, password from user")
    List<UserListVO> selectAllUser();

    @Delete("delete from user where id = #{id}")
    int deleteUserById(Integer id);

    int updateUser(User user);

    @Select("select id, username, password, nickname, created " +
            "from user where id = #{id}")
    User selectUserById(Integer id);
}
